//
//  ZSMainTabBarViewController.m
//  ZhuShou
//
//  Created by Dejun Liu on 15/10/28.
//  Copyright © 2015年 jw. All rights reserved.
//

#import "ZSMainTabBarViewController.h"
#import "BufferedNavigationController.h"

#import "ZSHomeViewController.h"
#import "ZSComfortableLifeViewController.h"
#import "ZSSecureLifeViewController.h"
#import "ZSSettingViewController.h"

#import "ZSLoginViewController.h"

@interface ZSMainTabBarViewController ()

@end

@implementation ZSMainTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self br_addChildViewControllerWithControllerName:@"ZSHomeViewController"
                                             andTitle:@"主页"
                                     andImageIconName:@"user"
                             andSelectedImageIconName:@""];
    [self br_addChildViewControllerWithControllerName:@"ZSComfortableLifeViewController"
                                             andTitle:@"舒适生活"
                                     andImageIconName:@"user"
                             andSelectedImageIconName:@""];
    [self br_addChildViewControllerWithControllerName:@"ZSComfortableLifeViewController"
                                             andTitle:@"安心生活"
                                     andImageIconName:@"user"
                             andSelectedImageIconName:@""];
    [self br_addChildViewControllerWithControllerName:@"ZSSettingViewController"
                                             andTitle:@"设置"
                                     andImageIconName:@"user"
                             andSelectedImageIconName:@""];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)br_addChildViewControllerWithControllerName:(NSString *)controllerName
                                           andTitle:(NSString *)title
                                   andImageIconName:(NSString *)imageIconName
                           andSelectedImageIconName:(NSString *)selectedImageIconName
{
    UIViewController *controller = [[NSClassFromString(controllerName) alloc]init];
    controller.title = title;
    UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:imageIconName] selectedImage:[UIImage imageNamed:selectedImageIconName]];
    controller.tabBarItem = item;

    UINavigationController *navi = [[BufferedNavigationController alloc] initWithRootViewController:controller];
    [self addChildViewController:navi];
}

@end
